<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Bmform extends CI_Controller {

	
	function form1()
	{
		
		echo "<pre>";
		print_r($_POST);
		echo "</pre>";
		
		die();
		
		$this->load->library('form_validation');
		
		$this->form_validation->set_rules('projectname','project name','required|xss_clean');
		
		$this->form_validation->set_rules('addressstreet','street','required|xss_clean');
		$this->form_validation->set_rules('addressstown','town','required|xss_clean');
		$this->form_validation->set_rules('addresssdistrict','district','required|xss_clean');
		
		$this->form_validation->set_rules('datelaunched','date launched','required|xss_clean');
		$this->form_validation->set_rules('ownersname','owner\'s name','required|xss_clean');
		$this->form_validation->set_rules('introduser','introdusere','required|xss_clean');
		
		
		if($this->form_validation->run() != false){
			
			echo "true";
			
		}
		else
		{
			echo validation_errors();
		}
	}
	function form2()
	{
		
		// sort bus root numbers
		
		$_POST['bustour_number']  = array_values($_POST['bustour_number']);
		
		/*
		$_POST['nameoftown'][]
		$_POST['roaddiscription'][]
		$_POST['towndistence'][]
		$_POST['rootdiscription'][]
		$_POST['rootdistance'][]
		$_POST['bustour_number'][]
		$_POST['station_name'][]
		$_POST['station_distance'][]
		$_POST['nameof_bank'][]
		$_POST['distence_bank'][]
		$_POST['supname'][]
		$_POST['supdistence'][]
		$_POST['hosname'][]
		$_POST['hosdistence'][]
		$_POST['schname'][]
		$_POST['schdistence'][]
		$_POST['txt_temple'][]
		$_POST['txt_church'][]
		$_POST['txt_kovil'][]
		$_POST['txt_mosque'][]
		$_POST['txt_police'][]
		$_POST['txt_mc'][]
		$_POST['txt_ds'][]
		$_POST['txt_postoffice'][]
		$_POST['txt_courts'][]
		$_POST['txt_cemetery'][]
		$_POST['txt_rockquarry'][]
		$_POST['txt_pigsty'][]
		$_POST['txt_chicken'][]
		$_POST['txt_cocunetpit'][]
		$_POST['txt_nostyfactories'][]
		$_POST['txt_shanties'][]

		
		echo "<pre>";
		print_r($_POST);
		echo "</pre>";
		
		  */		
		$this->load->library('form_validation');
		
		$this->form_validation->set_rules('towndistence[]', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('rootdistance[]', 'Distence', 'xss_clean|callback_nullornumaric_check');
		
		
		for($i=0; $i<count($_POST['bustour_number']); $i++)
		{
			$this->form_validation->set_rules('bustour_number['.$i.'][]', 'Distence', 'xss_clean|callback_nullornumaric_check');
			
		}
		
		
		$this->form_validation->set_rules('station_distance[]', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('distence_bank[]', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('hosdistence[]', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('schdistence[]', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_temple', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_church', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_kovil', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_mosque', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_police', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_mc', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_ds', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_postoffice', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_courts', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_cemetery', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_rockquarry', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_pigsty', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_chicken', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_cocunetpit', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_nostyfactories', 'Distence', 'xss_clean|callback_nullornumaric_check');
		$this->form_validation->set_rules('txt_shanties', 'Distence', 'xss_clean|callback_nullornumaric_check');

		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		
	}
	
	
	//check null or numaric
	
	
	public function nullornumaric_check($str)
	{
			if(($str==null)||preg_match("/^[0-9\.]+$/i",$str))
			{
				return true;
			}
			else
			{
				$this->form_validation->set_message('nullornumaric_check', 'Distence must content numbers');
				return false;
			}
	}
	
	
	
	
	
	
	
	function form3()
	{
		
		echo "true";
		/*
		echo "<pre>";
		print_r($_POST);
		echo "</pre>";
		
		$this->load->library('form_validation');
		
		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		*/
	}
	function form4()
	{
	
		echo "true";
		
		/*
		echo "<pre>";
		print_r($_POST);
		echo "</pre>";
		
		
		
		
		$this->load->library('form_validation');
		
		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		*/
	}
	function form5()
	{
	
		echo "true";
		
		/*
		$this->load->library('form_validation');
		
		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		*/
	}
	function form6()
	{
	
		echo "true";
		
		/*
		$this->load->library('form_validation');
		
		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		*/
	}
	function form7()
	{
	
		
		echo "<pre>";
		print_r($_POST);
		echo "</pre>";
		/*echo "true";
		
		
		$this->load->library('form_validation');
		
		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		*/
	}
	function form8()
	{
	
		echo "true";
		
		
		/*
		$this->load->library('form_validation');
		
		
		if($this->form_validation->run() != false){
				
			echo "true";
				
		}
		else
		{
			echo validation_errors();
		}
		*/
	}
}